'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 7_study_simple_use_runable_passthrough.py
* @Time: 2025/7/13
* @All Rights Reserve By Brtc
'''
import dotenv
from langchain_community.chat_models import ChatOpenAI
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.prompts.structured import StructuredPrompt
from langchain_core.runnables import RunnablePassthrough

dotenv.load_dotenv()

prompt = ChatPromptTemplate.from_template("{query}")
llm = ChatOpenAI(model="gpt-3.5-turbo-16k")
chain = {"query":RunnablePassthrough()}|prompt|llm|StrOutputParser()

""" 
以前的做法:
print(chain.invoke({"query", "请讲一个程序员的冷笑话"})) 
"""
print(chain.invoke("你好请讲一个关于程序员的笑话"))
